package com.neuedu.projectedu.utils;

import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class DateUtils {

    public static long diffDateTimeToHours(LocalDateTime src, LocalDateTime dsc) {
//        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
//        LocalDateTime ldp = LocalDateTime.parse(dsc, dtf);
        Duration duration = Duration.between(dsc, src);
        return duration.toHours();
    }

    public static String dateTimeFormatter(LocalDateTime localDateTime) {
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        String todayStr = dateTimeFormatter.format(localDateTime);
        return todayStr;
    }
}
